//
//  SegmentView.h
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/3/15.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef void(^segmentViewDidSelect)(NSInteger index, NSString *currentItem);
@class SegmentViewConfigModel;
@interface SegmentView : UIView


/**
 数据数组
 */
@property (nonatomic, strong) NSArray<NSString *> *itemArr;

/**
 当前下标
 */
@property (nonatomic, assign) NSInteger currentIndex;

/**
 选中了某个item的回调
 */
@property (nonatomic, copy) segmentViewDidSelect didSelectBlock;

/**
 显示样式
 */
@property (nonatomic, strong) SegmentViewConfigModel *configModel;


-(instancetype)initWithFrame:(CGRect)frame itemArr:(NSArray<NSString *> *)itemArr configModel:(SegmentViewConfigModel *)configModel;


/**
 用来lineView的位置

 @param index 目标位置
 @param percent 滚动的百分比
 */
- (void)segmetViewUpdateToIndex:(NSInteger)index byPercent:(CGFloat)percent;


/**
 滚动到特定的位置

 @param index 特定的下标
 */
-(void)scrollToIndex:(NSInteger)index;


@end
